# -*- coding: utf-8 -*-
# @Time    : 2018/7/1 17:14
# @Author  : Feng Cheng
# @Email   : fengcheng@pku.edu.cn

# -*- coding: utf-8 -*-
# @author: wangqian
# @email: wangqian@shanshu.ai
# @date: 2018/06/21

from statsmodels.tsa.arima_model import ARMA, ARIMA, ARIMAResults, ARIMAResultsWrapper


class Arima2(ARIMA):

    # def __init__(self, array_ts, **params):
    #     (self, array_ts, **params)
    def tt(self):
        print('kakak')
    # def fit(self, start_params=None, trend='c', method="css-mle",
    #         transparams=True, solver='lbfgs', maxiter=50, full_output=1,
    #         disp=0, callback=None, start_ar_lags=None, **kwargs):
    #
    #     mlefit = super(Arima, self).fit(start_params, trend,
    #                                     method, transparams, solver,
    #                                     maxiter, full_output, disp,
    #                                     callback, start_ar_lags, **kwargs)
    #     normalized_cov_params = None  # TODO: fix this?
    #     arima_fit = ArimaFit(self, mlefit._results.params,
    #                              normalized_cov_params)
    #     arima_fit.k_diff = self.k_diff
    #
    #     arima_fit.mle_retvals = mlefit.mle_retvals
    #     arima_fit.mle_settings = mlefit.mle_settings
    #
    #     return arima_fi
class ArimaFit(ARIMAResults):

    def forecast(self, steps=1, exog=None, alpha=.05):
        return super(ArimaFit, self).forecast(steps, exog, alpha)[0]


if __name__ == '__main__':
    import numpy as np
    params = {"order": [0, 0, 1]}
    array_ts = np.array([1.1, 2.0, 1.4, 2.3, 3.1])
    forecast_h = 3

    obj_arima = Arima2(ARIMA(array_ts, **params))
    # obj_arima=Arima()
    ts_fit = obj_arima.fit()
    pred_value = ts_fit.forecast(forecast_h)